﻿
@inject IPopupService PopupService

<div class="@Class">

    <CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaAlert Type="AlertTypes.Success" Color="tertiary" Class="mb-3">
        当你点击“完成”按钮时，将会立即发起审核请求，请在点击前确保内容正确无误
    </CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaAlert>
    <MDCard Outline="Outline" Class="pa-4">
        <div>
            <MTextarea Label="备注" Rows="3" @bind-Value="Model.Note"/>
            <CnGalWebSite.Components.Buttons.MasaButton Text="完成" IsAsync="true" OnClick="OnClickSubmit" Icon="mdi-check" Rounded/>
        </div>
    </MDCard>
</div>


@code {
    [Parameter]
    public BaseEditModel Model { get; set; }
    [Parameter]
    public string Class { get; set; }
    [Parameter]
    public bool Outline { get; set; }
    [Parameter]
    public EventCallback<string> OnSubmit { get; set; }

    public async Task OnClickSubmit()
    {
        var result = Model.Validate();
        if (result.Successful)
        {
            await OnSubmit.InvokeAsync();
        }
        else
        {
           await PopupService.ToastErrorAsync("某个地方填写有误哦~", result.Error ?? "某个地方填写有误哦~");
        }
    }


}
